package com.amt.olcacon;

import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class ExcelFromUrl {
    public static void main(String[] args) throws Exception {
        String fileUrl = "https://dev-productcarbon-amtcarbon.app.codewave.163.com:443/upload/工序导入模板v2.0(1).xlsx";

        // 打开 HTTP 连接
        URL url = new URL(fileUrl);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");

        try (InputStream inputStream = conn.getInputStream();
             Workbook workbook = new XSSFWorkbook(inputStream)) {

            Sheet sheet = workbook.getSheetAt(0);
            System.out.println("读取到的 Sheet 名称: " + sheet.getSheetName());
        }
    }
}